package com.edgclub.edg.uc;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.edgclub.edg.R;

public class ReportDialog extends Dialog implements
		View.OnClickListener {

	private TextView report,cancel;
	private RelativeLayout root;

	private SelectDialogClickListener selectDialogClickListener;


	public SelectDialogClickListener getSelectDialogClickListener() {
		return selectDialogClickListener;
	}

	public void setSelectDialogClickListener(SelectDialogClickListener selectDialogClickListener) {
		this.selectDialogClickListener = selectDialogClickListener;
	}

	public ReportDialog(Context context) {
		super(context, R.style.MyDialogStyleBottom);

	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_gz_report_dialog);
		root = (RelativeLayout) findViewById(R.id.root);
		report = (TextView) findViewById(R.id.report);
		cancel = (TextView) findViewById(R.id.cancel);

		cancel.setOnClickListener(this);
		report.setOnClickListener(this);
		root.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				dismiss();
			}
		});
		// 设置大小
		Display disp = getWindow().getWindowManager().getDefaultDisplay();
		WindowManager.LayoutParams lp = getWindow().getAttributes();
		lp.y = 30; // 30是屏幕底部toolbar的高度；
		lp.width = (int) disp.getWidth();
		lp.gravity = Gravity.BOTTOM;
		getWindow().setAttributes(lp);

	}

	@Override
	public void onClick(View view) {
		switch (view.getId()) {
			case R.id.report:
				if (null != selectDialogClickListener) {

					selectDialogClickListener.report();
				}
				break;
			case R.id.cancel:
				this.dismiss();
			break;
		}
	}

	public interface SelectDialogClickListener {

		public void report();
	}

}
